import { request } from "@/utils";

//获取文章频道
export const getChannelListAPI = () => {
  return request({
    url: '/channels',
    method: 'get',
  })
}

//新增文章
export const addAtticalAPI = (data) => {
  return request({
    url: '/mp/articles?draft=false',
    method: 'POST',
    data
  })
}

//获取文章列表
export const getArticalListAPI = (params) => {
  return request({
    url: '/mp/articles',
    method: 'get',
    params
  })
}

//删除文章
export const deleteArticalAPI=(id)=>{
  return request({
    url: `/mp/articles/${id}`,
    method:'delete'
  })
}

//获取文章详情
export const getArticalDetailAPI = (id)=>{
  return request({
    url:`/mp/articles/${id}`
  })
}

//更新文章
export const updateArticalAPI = (data)=>{
  return request({
    url: `/mp/articles/${data.id}?draft=false`,
    method:'put',
    data

  })
}


